<div id="pageContent" class="content-with-sidebar">
                    <div class="second-level-menu">
<ul class="second-level-menu-list"><li class="backLava" style="position: absolute; display: block; margin: 0px; padding: 0px; left: 0px; top: 0px; width: 63px; height: 20px;"><div class="leftLava"></div><div class="bottomLava"></div><div class="cornerLava"></div></li>
        <li class="current selectedLava"><a href="/problemset">Problems</a></li>
        <li><a href="/problemset/submit">Submit</a></li>
        <li><a href="/problemset/status">Status</a></li>
        <li><a href="/problemset/standings">Standings</a></li>
        <li><a href="/problemset/customtest">Custom test</a></li>
</ul>
</div>

    <style>
        #facebox .content:has(.diff-popup) {
            width: 90vw;
            max-width: 120rem !important;
        }

        .testCaseMarker {
            position: absolute;
            font-weight: bold;
            font-size: 1rem;
        }

        .diff-popup {
            width: 90vw;
            max-width: 120rem !important;
            display: none;
            overflow: auto;
        }

        .input-output-copier {
            font-size: 1.2rem;
            float: right;
            color: #888 !important;
            cursor: pointer;
            border: 1px solid rgb(185, 185, 185);
            padding: 3px;
            margin: 1px;
            line-height: 1.1rem;
            text-transform: none;
        }

        .input-output-copier:hover {
            background-color: #def;
        }

        .test-explanation textarea {
            width: 100%;
            height: 1.5em;
        }

        .pending-submission-message {
            color: darkorange !important;
        }
    </style>
    <script>
        const OPENING_SPACE = String.fromCharCode(1001);
        const CLOSING_SPACE = String.fromCharCode(1002);

        const nodeToText = function (node, pre) {
            let result = [];

            if (node.tagName === "SCRIPT" || node.tagName === "math"
                || (node.classList && node.classList.contains("input-output-copier")))
                return [];

            if (node.tagName === "NOBR") {
                result.push(OPENING_SPACE);
            }

            if (node.nodeType === Node.TEXT_NODE) {
                let s = node.textContent;
                if (!pre) {
                    s = s.replace(/\s+/g, " ");
                }
                if (s.length > 0) {
                    result.push(s);
                }
            }

            if (pre && node.tagName === "BR") {
                result.push("\n");
            }

            node.childNodes.forEach(function (child) {
                result.push(nodeToText(child, node.tagName === "PRE").join(""));
            });

            if (node.tagName === "DIV"
                || node.tagName === "P"
                || node.tagName === "PRE"
                || node.tagName === "UL"
                || node.tagName === "LI"
            ) {
                result.push("\n");
            }

            if (node.tagName === "NOBR") {
                result.push(CLOSING_SPACE);
            }

            return result;
        }

        const isSpecial = function (c) {
            return c === ',' || c === '.' || c === ';' || c === ')' || c === ' ';
        }

        const convertStatementToText = function(statmentNode) {
            const text = nodeToText(statmentNode, false).join("").replace(/ +/g, " ").replace(/\n\n+/g, "\n\n");
            let result = [];
            for (let i = 0; i < text.length; i++) {
                const c = text.charAt(i);
                if (c === OPENING_SPACE) {
                    if (!((i > 0 && text.charAt(i - 1) === '(') || (result.length > 0 && result[result.length - 1] === ' '))) {
                        result.push('+');
                    }
                } else if (c === CLOSING_SPACE) {
                    if (!(i + 1 < text.length && isSpecial(text.charAt(i + 1)))) {
                        result.push('-');
                    }
                } else {
                    result.push(c);
                }
            }
            return result.join("").split("\n").map(value => value.trim()).join("\n");
        };
    </script>
    <div class="diff-popup">
    </div>

<div class="problemindexholder" problemindex="A" data-uuid="ps_452f1f7f32401d56dfaa60e868f9afdf579881bd">
    <div style="display: none; margin:1em 0;text-align: center; position: relative;" class="alert alert-info diff-notifier">
        <div>The problem statement has recently been changed. <a class="view-changes" href="#">View the changes.</a></div>
        <span class="diff-notifier-close" style="position: absolute; top: 0.2em; right: 0.3em; cursor: pointer; font-size: 1.4em;">×</span>
    </div>
        <div class="ttypography"><div class="problem-statement"><div class="header"><div class="title">A. Bit++</div><div class="time-limit"><div class="property-title">time limit per test</div>1 second</div><div class="memory-limit"><div class="property-title">memory limit per test</div>256 megabytes</div><div class="input-file input-standard" style="font-weight: bold"><div class="property-title">input</div>stdin</div><div class="output-file output-standard" style="font-weight: bold"><div class="property-title">output</div>stdout</div></div><div><p>The classic programming language of Bitland is Bit++. This language is so peculiar and complicated.</p><p>The language is that peculiar as it has exactly one variable, called <span class="tex-span"><i>x</i></span>. Also, there are two operations:</p><ul> <li> Operation <span class="tex-font-style-tt">++</span> increases the value of variable <span class="tex-span"><i>x</i></span> by 1. </li><li> Operation <span class="tex-font-style-tt">--</span> decreases the value of variable <span class="tex-span"><i>x</i></span> by 1. </li></ul><p>A statement in language Bit++ is a sequence, consisting of exactly one operation and one variable <span class="tex-span"><i>x</i></span>. The statement is written without spaces, that is, it can only contain characters "<span class="tex-font-style-tt">+</span>", "<span class="tex-font-style-tt">-</span>", "<span class="tex-font-style-tt">X</span>". Executing a statement means applying the operation it contains.</p><p>A programme in Bit++ is a sequence of statements, each of them needs to be executed. Executing a programme means executing all the statements it contains.</p><p>You're given a programme in language Bit++. The initial value of <span class="tex-span"><i>x</i></span> is <span class="tex-span">0</span>. Execute the programme and find its final value (the value of the variable when this programme is executed).</p></div><div class="input-specification"><div class="section-title">Input</div><p>The first line contains a single integer <span class="tex-span"><i>n</i></span> <span class="tex-span">(1 ≤ <i>n</i> ≤ 150)</span> — the number of statements in the programme.</p><p>Next <span class="tex-span"><i>n</i></span> lines contain a statement each. Each statement contains exactly one operation (<span class="tex-font-style-tt">++</span> or <span class="tex-font-style-tt">--</span>) and exactly one variable <span class="tex-span"><i>x</i></span> (denoted as letter «<span class="tex-font-style-tt">X</span>»). Thus, there are no empty statements. The operation and the variable can be written in any order.</p></div><div class="output-specification"><div class="section-title">Output</div><p>Print a single integer — the final value of <span class="tex-span"><i>x</i></span>.</p></div><div class="sample-tests"><div class="section-title">Examples</div><div class="sample-test"><div class="input"><div class="title">Input<div title="Copy" data-clipboard-target="#id004314825841561035" id="id007576703687848123" class="input-output-copier">Copy</div></div><pre id="id004314825841561035">1<br>++X<br></pre></div><div class="output"><div class="title">Output<div title="Copy" data-clipboard-target="#id0005699439397076389" id="id0035740728123150733" class="input-output-copier">Copy</div></div><pre id="id0005699439397076389">1<br></pre></div><div class="input"><div class="title">Input<div title="Copy" data-clipboard-target="#id0030555833681339617" id="id0002395881125307775" class="input-output-copier">Copy</div></div><pre id="id0030555833681339617">2<br>X++<br>--X<br></pre></div><div class="output"><div class="title">Output<div title="Copy" data-clipboard-target="#id008204342844490438" id="id0022182225292804192" class="input-output-copier">Copy</div></div><pre id="id008204342844490438">0<br></pre></div></div></div></div></div>
</div>

    <script>
        $(function () {
            Codeforces.addMathJaxListener(function () {
                let $problem = $("div[problemindex=A]");
                let uuid = $problem.attr("data-uuid");
                let statementText = convertStatementToText($problem.find(".ttypography").get(0));

                let previousStatementText = Codeforces.getFromStorage(uuid);
                if (previousStatementText) {
                    if (previousStatementText !== statementText) {
                        $problem.find(".diff-notifier").show();

                        $problem.find(".diff-notifier-close").click(function() {
                            Codeforces.putToStorageTtl(uuid, statementText, 6 * 60 * 60);
                            $problem.find(".diff-notifier").hide();
                        });

                        $problem.find("a.view-changes").click(function() {
                            $.post("/data/diff", {action: "getDiff", a: previousStatementText, b: statementText}, function (result) {
                                if (result["success"] === "true") {
                                    Codeforces.facebox(".diff-popup", "//codeforces.org/s/97597");
                                    $("#facebox .diff-popup").html(result["diff"]);
                                }
                            }, "json");
                        });
                    }
                } else {
                    Codeforces.putToStorageTtl(uuid, statementText, 6 * 60 * 60);
                }
            });
        });
    </script>


<script type="text/javascript">
    $(document).ready(function () {
            window.changedTests = new Set();

        const inputFileDiv = $("div.input-file");
        const inputFile = inputFileDiv.text();
        const outputFileDiv = $("div.output-file");
        const outputFile = outputFileDiv.text();


        if (!endsWith(inputFile, "standard input")
            && !endsWith(inputFile, "standard input")) {
            inputFileDiv.attr("style", "font-weight: bold");
        }

        if (!endsWith(outputFile, "standard output")
            && !endsWith(outputFile, "standard output")) {
            outputFileDiv.attr("style", "font-weight: bold");
        }

        const titleDiv = $("div.header div.title");



        String.prototype.replaceAll = function (search, replace) {
            return this.split(search).join(replace);
        };

        $(".sample-test .title").each(function () {
            const preId = ("id" + Math.random()).replaceAll(".", "0");
            const cpyId = ("id" + Math.random()).replaceAll(".", "0");

            $(this).parent().find("pre").attr("id", preId);
            const $copy = $("<div title='Copy' data-clipboard-target='#" + preId + "' id='" + cpyId + "' class='input-output-copier'>Copy</div>");
            $(this).append($copy);

            const clipboard = new Clipboard('#' + cpyId, {
                text: function (trigger) {
                    const pre = document.querySelector('#' + preId);
                    const lines = pre.querySelectorAll(".test-example-line");
                    return Codeforces.filterClipboardText(pre.innerText, lines.length);
                }
            });

            const isInput = $(this).parent().hasClass("input");

            clipboard.on('success', function (e) {
                if (isInput) {
                    Codeforces.showMessage("The example input has been copied into the clipboard");
                } else {
                    Codeforces.showMessage("The example output has been copied into the clipboard");
                }
                e.clearSelection();
            });
        });

        $(".test-form-item input").change(function () {
            addPendingSubmissionMessage($($(this).closest("form")), "You changed the answer, do not forget to submit it if you want to save the changes");
            const index = $(this).closest(".problemindexholder").attr("problemindex");
            let test = "";
            $(this).closest("form input").each(function () {
                const test_ = $(this).attr("name");
                if (test_ && test_.substring(0, 4) === "test") {
                    test = test_;
                }
            });
            if (index.length > 0 && test.length > 0) {
                const indexTest = index + "::" + test;
                window.changedTests.add(indexTest);
            }
        });

        $(window).on('beforeunload', function () {
            if (window.changedTests.size > 0) {
                return 'Dialog text here';
            }
        });

        autosize($('.test-explanation textarea'));

        function showTestCaseMarker($input, tp, clazz, end) {
            let top = 1E20;
            let left = 1E20;
            let problem = $input.closest(".problemindexholder");
            $input.find("." + clazz).css("background-color", "#FFFDE7").each(function() {
                top = Math.min(top, $(this).offset().top);
                left = Math.min(left, $(this).offset().left);
            });
            let testCaseMarker = problem.find(".testCaseMarker_" + tp + "_" + end);
            if (testCaseMarker.length === 0) {
                const html = "<div class=\"testCaseMarker testCaseMarker_" + tp + "_" + end + " notice\"></div>";
                problem.append($(html));
                testCaseMarker = problem.find(".testCaseMarker_" + tp + "_" + end);
            }
            if (testCaseMarker) {
                testCaseMarker.show()
                    .offset({top, left: left - 20})
                    .text(end);
            }
        }

        $(".test-example-line").hover(function() {
            $(this).attr("class").split(" ").forEach((clazz) => {
                if (clazz.substr(0, "test-example-line-".length) === "test-example-line-") {
                    let end = clazz.substr("test-example-line-".length);
                    if (end !== "even" && end !== "odd" && end !== "0") {
                        showTestCaseMarker($(this).closest(".sample-test").find(".input"), "input", clazz, end);
                        showTestCaseMarker($(this).closest(".sample-test").find(".output"), "output", clazz, end);
                    }
                }
            });
        }, function() {
            $(this).attr("class").split(" ").forEach((clazz) => {
                if (clazz.substr(0, "test-example-line-".length) === "test-example-line-") {
                    let end = clazz.substr("test-example-line-".length);
                    if (end !== "even" && end !== "odd" && end !== "0") {
                        $("." + clazz).css("background-color", "");
                        $(this).closest(".problemindexholder").find(".testCaseMarker_input_" + end).hide();
                        $(this).closest(".problemindexholder").find(".testCaseMarker_output_" + end).hide();
                    }
                }
            });
        });

    });
</script>
                </div>